import { createApp } from 'vue';
import videoDialog from './main.vue';

let Instances = [];

videoDialog.newInstance = (cb) => {
  const ins = createApp(videoDialog);

  // 创建元素节点
  const rootNode = document.createElement('div');
  rootNode.style.float = "left"
  // 在body标签内部插入此元素
  document.querySelector('#video_container').appendChild(rootNode);
  let app = ins.mount(rootNode);
  Instances.push(app);
  return {
    diagram: app,
    closeAll: () => {
      Instances.forEach((x) => {
        x.show = false;
        x.closeDialog && x.closeDialog()
      });
      cb && cb()
      Instances = [];
    },
  };
};
export default videoDialog;
